package com.dgy.project.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dgy.project.mapper.ProjectInfoMapper;
import com.dgy.project.domain.ProjectInfo;
import com.dgy.project.service.IProjectInfoService;

/**
 * 课题申报信息Service业务层处理
 *
 * @author ccc
 * @date 2025-03-18
 */
@Service
public class ProjectInfoServiceImpl implements IProjectInfoService
{
    @Autowired
    private ProjectInfoMapper projectInfoMapper;

    /**
     * 查询课题申报信息
     *
     * @param projectId 课题申报信息主键
     * @return 课题申报信息
     */
    @Override
    public ProjectInfo selectProjectInfoById(Long projectId)
    {
        return projectInfoMapper.selectProjectInfoByProjectId(projectId);
    }

    /**
     * 查询课题申报信息列表
     *
     * @param projectInfo 课题申报信息
     * @return 课题申报信息
     */
    @Override
    public List<ProjectInfo> selectProjectInfoList(ProjectInfo projectInfo)
    {
        return projectInfoMapper.selectProjectInfoList(projectInfo);
    }

    /**
     * 新增课题申报信息
     *
     * @param projectInfo 课题申报信息
     * @return 结果
     */
    @Override
    public Long insertProjectInfo(ProjectInfo projectInfo)
    {
        projectInfo.setCreateTime(DateUtils.getNowDate());
        projectInfoMapper.insertProjectInfo(projectInfo);
        return projectInfo.getProjectId();
    }

    /**
     * 修改课题申报信息
     *
     * @param projectInfo 课题申报信息
     * @return 结果
     */
    @Override
    public int updateProjectInfo(ProjectInfo projectInfo)
    {
        projectInfo.setUpdateTime(DateUtils.getNowDate());
        return projectInfoMapper.updateProjectInfo(projectInfo);
    }

    /**
     * 批量删除课题申报信息
     *
     * @param ids 需要删除的课题申报信息主键
     * @return 结果
     */
    @Override
    public int deleteProjectInfoByIds(Long[] ids)
    {
        return projectInfoMapper.deleteProjectInfoByProjectIds(ids);
    }

    /**
     * 删除课题申报信息信息
     *
     * @param id 课题申报信息主键
     * @return 结果
     */
    @Override
    public int deleteProjectInfoById(Long id)
    {
        return projectInfoMapper.deleteProjectInfoByProjectId(id);
    }
}
